package org.opentcs.kcvehicle.communication.kc.udp.agv.param.function.af;

import org.opentcs.kcvehicle.communication.kc.common.byteutils.ByteUtils;

public class RunningStatusInfo {
  private byte[] src;
  //4个字节,车 轴x 速度,单位 m/s
  public float speedX;
  //4个字节,车 轴y 速度,单位 m/s
  public float speedY;
  //车角速度,单位 rad/s
  public float angularSpeed;
  //工作模式
  public byte workMode;
  //agv 状态，1个字节
  public byte agvStatus;
  //机器人能力集设置状态,1个字节
  public byte abilitySetStatus;
  //预留,5个字节
  public byte[] remain;

  public RunningStatusInfo(byte[] src) {
    this.src = src;
    this.speedX = ByteUtils.bytesToFloat(src, 0);
    this.speedY = ByteUtils.bytesToFloat(src, 4);
    this.angularSpeed = ByteUtils.bytesToFloat(src, 8);
    this.workMode = src[12];
    this.agvStatus = src[13];
    this.abilitySetStatus = src[14];
    this.remain = new byte[5];
    for (int i = 0; i < 5; i++) {
      this.remain[i] = src[15 + i];
    }
  }
}
